<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="travelSearch" styleClass="edit">

        <rich:simpleTogglePanel label="Travel Search Filter" switchType="ajax">

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Name</ui:define>
                <h:inputText id="name" value="#{travelList.travel.name}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Travel state</ui:define>
                <h:inputText id="travelState" value="#{travelList.travel.travelState}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Cron expression</ui:define>
                <h:inputText id="cronExpression" value="#{travelList.travel.cronExpression}"/>
            </s:decorate>

            <s:decorate template="layout/display.xhtml">
                <ui:define name="label">Match</ui:define>
                <h:selectOneRadio id="logic" value="#{travelList.restrictionLogicOperator}" styleClass="radio">
                    <f:selectItem itemLabel="All" itemValue="and"/>
                    <f:selectItem itemLabel="Any" itemValue="or"/>
                </h:selectOneRadio>
            </s:decorate>

        </rich:simpleTogglePanel>

        <div class="actionButtons">
            <h:commandButton id="search" value="Search" action="/TravelList.xhtml"/>
            <s:button id="reset" value="Reset" includePageParams="false"/>
        </div>

    </h:form>

    <rich:panel>
        <f:facet name="header">Travel Search Results (#{empty travelList.resultList ? 0 : (travelList.paginated ? travelList.resultCount : travelList.resultList.size)})</f:facet>
    <div class="results" id="travelList">

    <h:outputText value="The travel search returned no results."
               rendered="#{empty travelList.resultList}"/>

    <rich:dataTable id="travelList"
                var="_travel"
              value="#{travelList.resultList}"
           rendered="#{not empty travelList.resultList}">
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Id travel"/>
                    <ui:param name="propertyPath" value="travel.idTravel"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.idTravel}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="City by to city id city"/>
                    <ui:param name="propertyPath" value="travel.cityByToCity.idCity"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.cityByToCity.idCity}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="State by from state id state"/>
                    <ui:param name="propertyPath" value="travel.stateByFromState.idState"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.stateByFromState.idState}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Country by from country id country"/>
                    <ui:param name="propertyPath" value="travel.countryByFromCountry.idCountry"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.countryByFromCountry.idCountry}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="User id user"/>
                    <ui:param name="propertyPath" value="travel.user.idUser"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.user.idUser}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="State by to state id state"/>
                    <ui:param name="propertyPath" value="travel.stateByToState.idState"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.stateByToState.idState}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="City by from city id city"/>
                    <ui:param name="propertyPath" value="travel.cityByFromCity.idCity"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.cityByFromCity.idCity}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Country by to country id country"/>
                    <ui:param name="propertyPath" value="travel.countryByToCountry.idCountry"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.countryByToCountry.idCountry}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Name"/>
                    <ui:param name="propertyPath" value="travel.name"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.name}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="From lat"/>
                    <ui:param name="propertyPath" value="travel.fromLat"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.fromLat}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="From lon"/>
                    <ui:param name="propertyPath" value="travel.fromLon"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.fromLon}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="To lat"/>
                    <ui:param name="propertyPath" value="travel.toLat"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.toLat}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="To lon"/>
                    <ui:param name="propertyPath" value="travel.toLon"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.toLon}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Distance"/>
                    <ui:param name="propertyPath" value="travel.distance"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.distance}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Travel state"/>
                    <ui:param name="propertyPath" value="travel.travelState"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.travelState}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Calculated rate"/>
                    <ui:param name="propertyPath" value="travel.calculatedRate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.calculatedRate}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Create date"/>
                    <ui:param name="propertyPath" value="travel.createDate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.createDate}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Modify date"/>
                    <ui:param name="propertyPath" value="travel.modifyDate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.modifyDate}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Delete date"/>
                    <ui:param name="propertyPath" value="travel.deleteDate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.deleteDate}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Cron expression"/>
                    <ui:param name="propertyPath" value="travel.cronExpression"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.cronExpression}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Monday"/>
                    <ui:param name="propertyPath" value="travel.monday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.monday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Tuesday"/>
                    <ui:param name="propertyPath" value="travel.tuesday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.tuesday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Wednesday"/>
                    <ui:param name="propertyPath" value="travel.wednesday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.wednesday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Thursday"/>
                    <ui:param name="propertyPath" value="travel.thursday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.thursday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Friday"/>
                    <ui:param name="propertyPath" value="travel.friday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.friday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Saturday"/>
                    <ui:param name="propertyPath" value="travel.saturday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.saturday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Sunday"/>
                    <ui:param name="propertyPath" value="travel.sunday"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.sunday}"/>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Begin date"/>
                    <ui:param name="propertyPath" value="travel.beginDate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.beginDate}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="End date"/>
                    <ui:param name="propertyPath" value="travel.endDate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.endDate}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </h:column>
        <h:column>
            <f:facet name="header">
                <ui:include src="layout/sort.xhtml">
                    <ui:param name="entityList" value="#{travelList}"/>
                    <ui:param name="propertyLabel" value="Single day"/>
                    <ui:param name="propertyPath" value="travel.singleDay"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_travel.singleDay}"/>
        </h:column>
        <rich:column styleClass="action">
            <f:facet name="header">Action</f:facet>
            <s:link view="/#{empty from ? 'Travel' : from}.xhtml"
                   value="#{empty from ? 'View' : 'Select'}"
             propagation="#{empty from ? 'none' : 'default'}"
                      id="travelViewId">
                <f:param name="travelIdTravel"
                        value="#{_travel.idTravel}"/>
            </s:link>
            #{' '}
            <s:link view="/TravelEdit.xhtml"
                   value="Edit"
             propagation="none"
                      id="travelEdit"
                rendered="#{empty from}">
                <f:param name="travelIdTravel"
                        value="#{_travel.idTravel}"/>
            </s:link>
        </rich:column>
    </rich:dataTable>

    </div>
    </rich:panel>

    <div class="tableControl">

        <s:link view="/TravelList.xhtml"
            rendered="#{travelList.previousExists}"
               value="#{messages.left}#{messages.left} First Page"
                  id="firstPage">
          <f:param name="firstResult" value="0"/>
        </s:link>

        <s:link view="/TravelList.xhtml"
            rendered="#{travelList.previousExists}"
               value="#{messages.left} Previous Page"
                  id="previousPage">
            <f:param name="firstResult"
                    value="#{travelList.previousFirstResult}"/>
        </s:link>

        <s:link view="/TravelList.xhtml"
            rendered="#{travelList.nextExists}"
               value="Next Page #{messages.right}"
                  id="nextPage">
            <f:param name="firstResult"
                    value="#{travelList.nextFirstResult}"/>
        </s:link>

        <s:link view="/TravelList.xhtml"
            rendered="#{travelList.nextExists}"
               value="Last Page #{messages.right}#{messages.right}"
                  id="lastPage">
            <f:param name="firstResult"
                    value="#{travelList.lastFirstResult}"/>
        </s:link>

    </div>

    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <s:button view="/TravelEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Create travel">
            <f:param name="travelIdTravel"/>
        </s:button>
    </s:div>

</ui:define>

</ui:composition>
